package com.feri.rbacsys.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.feri.rbacsys.dao.DepositoryDao;
import com.feri.rbacsys.dto.DepositoryDto;
import com.feri.rbacsys.entity.Depository;
import com.feri.rbacsys.service.intf.DepositoryService;
import com.feri.rbacsys.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Depository)表服务实现类
 *
 * @author makejava
 * @since 2023-03-28 10:02:55
 */
@Service("depositoryService")
public class DepositoryServiceImpl extends ServiceImpl<DepositoryDao, Depository> implements DepositoryService {

    @Resource
    private DepositoryDao dao;


    @Override
    public R selectPage(Integer page, Integer size,String orderNum,String productName) {

        return R.ok(dao.all(new Page<DepositoryDto>(page,size),orderNum,productName));
    }

    @Override
    public R ban(Integer id) {
        Depository depository = new Depository();
        depository.setId(id);
        depository.setStatus(1);
        if(dao.updateById(depository)>0){
            return R.ok();
        }
        return R.fail();
    }

}

